package com.school.movie.common.exception;


import com.school.movie.common.model.ResultCode;

/**
 * @author yangzy
 * @date 2020/07/06
 * 权限拒绝异常
 */
public class PermissionDeniedException extends RuntimeException {

    private final ResultCode resultCode;

    public PermissionDeniedException(String message) {
        super(message);
        this.resultCode = ResultCode.UN_AUTHORIZED;
    }

    public PermissionDeniedException(ResultCode resultCode) {
        super(resultCode.getMsg());
        this.resultCode = resultCode;
    }

    public PermissionDeniedException(ResultCode resultCode, Throwable cause) {
        super(cause);
        this.resultCode = resultCode;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

    public ResultCode getResultCode() {
        return resultCode;
    }
}
